// 表单验证
const formRules = {
  nonNull: {
    required: true,
    message: '必填项，不能为空',
    whitespace: false
  },
  nonNullBlur: {
    required: true,
    message: '必填项，不能为空',
    trigger: 'blur',
    whitespace: false
  },
  nonNullChange: {
    required: true,
    message: '必填项，不能为空',
    trigger: 'change'
  },
  idNumber: {
    pattern: /^\d{17}[Xx\d]$/,
    message: '身份证号错误'
  },
  phone: {
    pattern: /^1[34578]\d{9}$/,
    message: '手机号错误'
  },
  bankCard: {
    pattern: /^([1-9]{1})(\d{12,18})$/,
    message: '银行卡号错误'
  },
  email: {
    type: 'email',
    message: '邮箱号错误'
  },
  url: {
    type: 'url',
    message: 'URL错误'
  },
  /** 经度验证 */
  lng: {
    pattern: /^(\-|\+)?(((\d|[1-9]\d|1[0-7]\d|0{1,3})\.\d{0,6})|(\d|[1-9]\d|1[0-7]\d|0{1,3})|180\.0{0,6}|180)$/,
    message: '经度错误'
  },
  /** 纬度验证 */
  lat: {
    pattern: /^(\-|\+)?([0-8]?\d{1}\.\d{0,6}|90\.0{0,6}|[0-8]?\d{1}|90)$/,
    message: '纬度错误'
  }
};

export { formRules };
